(function () {
  // 步骤1：创建echarts实例
  let myChart = echarts.init(document.querySelector(".pc-m3"));

  // 步骤2：定义配置（指定图表的配置项和数据）
  let option = {
    grid: {
      top: 20,
      left: 50,
      right: 20,
      bottom: "15%",
    },
    xAxis: [
      {
        type: "category",
        axisLine: {
          show: false,
          color: "#A582EA",
        },

        axisLabel: {
          color: "#90A0AE",
          width: 100,
        },
        splitLine: {
          show: false,
        },
        boundaryGap: false,
        data: [
          "01:00",
          "02:00",
          "03:00",
          "04:00",
          "05:00",
          "06:00",
          "07:00",
          "08:00",
          "09:00",
          "10:00",
          "11:00",
          "12:00",
        ],
      },
    ],

    yAxis: [
      {
        type: "value",
        min: 0,
        splitNumber: 10,
        splitLine: {
          show: true,
          lineStyle: {
            color: "#fff",
            opacity: 0.1,
          },
        },
        axisLine: {
          show: false,
        },
        axisLabel: {
          show: true,
          margin: 20,
          textStyle: {
            color: "#90A0AE",
          },
        },
        axisTick: {
          show: false,
        },
      },
    ],
    series: [
      {
        type: "line",
        showAllSymbol: true,
        symbol: "circle",
        smooth: true,
        symbolSize: 5,
        lineStyle: {
          normal: {
            color: "#ff6e1b",
          },
        },
        label: {
          show: true,
          position: "top",
          textStyle: {
            color: "#fff",
            fontSize: 8,
          },
        },
        itemStyle: {
          color: "#fff",
          borderColor: "#ff6e1b",
          borderWidth: 0,
        },
        areaStyle: {
          normal: {
            color: new echarts.graphic.LinearGradient(
              0,
              0,
              0,
              1,
              [
                {
                  offset: 0,
                  color: "rgba(235,84,64,0.3)",
                },
                {
                  offset: 1,
                  color: "rgba(235,84,64,0)",
                },
              ],
              false
            ),
          },
        },
        data: [
          158.68, 177.84, 182.2, 97.89, 248.98, 176.83, 133.49, 292.09, 186.58,
          184.02, 209.62, 203.4,
        ],
      },
    ],
  };

  // 步骤3：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  // 步骤4：监控网页视口
  window.addEventListener("resize", () => {
    myChart.resize();
  });
})();
